<?php

declare(strict_types=1);

/**
 * Author: Jesse
 * Email : jessedev@163.com
 * Date: 2024/6/16 21:13
 * FileName: TestCrontab.php
 * DESC: The Relentless Pursuit of Perfection.
 */
namespace App\Task;

use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Crontab\Annotation\Crontab;
use Hyperf\Di\Annotation\Inject;
use function Hyperf\Config\config;

/**
 * 定时任务
 */
class TestCrontab
{
    #[Inject]
    private StdoutLoggerInterface $log;

    #[Crontab( rule: '* * * * *',name: 'test.execute', memo: 'demo定时任务')]
    public function execute(): void
    {
        $this->log->debug('读取的配置内容是：'. config('test'));
        $this->log->debug('现在时间' . date('Y-m-d H:i:s', time()));
    }
}